home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Sound Cards
/
Programming Sound Cards.iso
/
sound_70
/
rawout.c
< prev
next >
Wrap
Text File
|
1995-01-01
|
2KB
|
69 lines
//------------------------------------------------------------------------------
// Copyright (c) David Welch, 1993
//------------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include "sb.h"
unsigned char ca;
unsigned short ra;
unsigned long la;
FILE *fp;
unsigned char gstring[80];
unsigned long dLen;
//------------------------------------------------------------------------------
void main ( int argc, char *argv[] )
{
if(argc<3)
{
printf("RAWOUT [d:][path]filename[.ext] samplerate\n");
exit(1);
}
if((fp=fopen(argv[1],"rb"))==0)
{
printf("Error opening file [%s]\n",argv[1]);
exit(1);
}
printf("FILE: [%s]\n",argv[1]);
sbinit();
sbmalloc();
fseek(fp,0L,2);
dLen=ftell(fp);
fseek(fp,0L,0);
ra=atoi(argv[2]);
printf("Samples Per Second %u\n",ra);
ca=256UL-(1000000UL/ra);
printf("Time Constant %u\n",ca);
sbsettc(ca);
spkon();
while(dLen)
{
if(dLen>65000) la=65000; else la=dLen;
dLen-=la;
fread(aligned,1,la,fp);
sbplay(la);
printf("%lu Samples\n",la);
// while(dmacount()!=0xFFFF)
dmastatus();
while(!dmastatus())
{
if(kbhit())
{
sbhaltdma();
getch();
dLen=0;
break;
}
}
}
spkoff();
}
//------------------------------------------------------------------------------
// Copyright (c) David Welch, 1993
//------------------------------------------------------------------------------